home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / AllPlaton / Unsorted / 3DBallNBat.AMOS / 3DBallNBat.amosSourceCode next >
Encoding:
AMOS Source Code  |  1993-08-10  |  1.3 KB  |  56 lines

  1. 'Load Iff "dh1:amosgfx/Ballnbat.iff",0 
  2. 'X=0 : G=64
  3. 'For A=0 To 15 : Colour A+16,Colour(A) : Next  
  4. 'For A=0 To 6
  5. '  Get Sprite A+1,X,0 To X+G,G 
  6. '  Hot Spot A+1,G/2-1,G/2-1
  7. '  Add X,G 
  8. '  G=G-8 
  9. 'Next  
  10. Hide 
  11. Screen Open 0,320,200,4,0
  12. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  13. Double Buffer 
  14. Autoback 0
  15. Get Sprite Palette 
  16. Palette 0,$FFF,$CCC,$888
  17. Degree 
  18. XB=1600 : YB=1500 : ZB=-500
  19. XS=40 : YS=-30 : ZS=0
  20. Do 
  21.   Screen Swap : Cls 
  22.   XM=X Mouse-128 : YM=Y Mouse
  23.   D=Sin((YM-50)/2)*80
  24.   Y=YM : X=XM-20 : Gosub DCO
  25.   X1=RX : Y1=RY
  26.   Y=YM : X=XM+20 : Gosub DCO
  27.   X2=RX : Y2=RY+(X2-X1)/4
  28.   Y=YM-D : X=XM-20 : Gosub DCO
  29.   X3=RX : Y3=RY
  30.   Y=YM-D : X=XM+20 : Gosub DCO
  31.   X4=RX : Y4=RY+(X4-X3)/4
  32.   Ink 3 : Polygon X1,Y1 To X3,Y3 To X3,Y4 To X1,Y2
  33.   Polygon X2,Y1 To X4,Y3 To X4,Y4 To X2,Y2
  34.   Ink 1 : Bar X1,Y1 To X2,Y2
  35.   Ink 2 : Polygon X1,Y1 To X2,Y1 To X4,Y3 To X3,Y3
  36.   Wait Vbl 
  37.   Home 
  38.   If YB<0 or YB>2000 Then YS=-YS
  39.   If XB<0 or XB>3200 Then XS=-XS
  40.   Add XB,XS : Add YB,YS : Add ZB,ZS : Inc ZS
  41.   X=XB/10 : Y=YB/10 : Gosub DCO
  42.   RZ=ZB/10
  43.   If ZB>-200 and(XM-10<(XB/10)) and(XM+10>(XB/10)) and(YM-60<(YB/10)) and(YM-40>(YB/10))
  44.     ZS=-Abs(ZS)
  45.   End If 
  46.   Plot XB/10,YB/10,1
  47.   Plot XM,YM-50,2
  48.   Sprite 0,RX+128,RY+50+RZ,Max(Min((200-Y)/20,7),1)
  49.   Print "X:";RX;"   "
  50.   Print "Y:";RY;"   "
  51.   Print "Z:";RZ;"   "
  52. Loop 
  53. DCO:
  54.   RY=Y/4+100
  55.   RX=160+((X-160)*Y)/150
  56. Return